<?php
class Tools_Trans_Trans{

	public static $findex=array();
	public static $init=false;

	public static function init(){
		self::$init=true;
		log::n(__METHOD__);
	}

	public static function setFIndex($key,$index){
		self::$findex[$key]=$index;
	}


	public static function transBatchFromBaidu($arrData){
		self::$findex=array();
		self::$rfindex[$intKey]=array();

		ksort($arrData);
		$intKey=0;
		foreach($arrData as $k=>&$v){
			self::$findex[$k]=$intKey;
			self::$rfindex[$intKey]=$k;
			$v=addTransBatchEmptyNull($v);
			$intKey++;
		}unset($v);

		$strBaseInfo = implode("\n", $arrData);

		$arrTransResult=transBatchDataFromBaidu($strBaseInfo);

		 if (!isset($arrTransResult["trans_result"]) || empty($arrTransResult["trans_result"]) || !is_array($arrTransResult["trans_result"])) {
			log::e('transBookBaseBatchInfoFromBaidu.error', $v['id']);
			sleep(7);
			continue;
		}

		$transResult = $arrTransResult["trans_result"];
		$arrReturnResult=array();

		foreach($transResult as $k=>$v){
			$arrReturnResult[self::$rfindex[$k]]=$v['dst'];
		}
	
	}


}
?>